package com.damai.mvc.view.imple;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.citywithincity.api.ApiConfig;
import com.citywithincity.utils.JsonUtil;
import com.damai.action.IAction;
import com.damai.action.IRender;

class DefRender implements IRender<Object> {

	public static final IRender<Object> DEFAULT = new DefRender();
	
	private DefRender(){
		
	}

	@Override
	public void render(IAction action,Object data, HttpServletRequest request, HttpServletResponse response) throws IOException {
		String value = JsonUtil.success(data);
		if(ApiConfig.out){
			ApiConfig.info(value);
		}
		response.getWriter().print(value);
	}

}
